<?php

declare(strict_types=1);

namespace App\Model\Friend;

use Hyperf\DbConnection\Model\Model;

/**
 *  左右滑动
 */
class SlideOp extends Model
{
    protected $table = 'slide_op_record';

    //左滑
    const SLIDE_OP_LEFT = 0;
    //右滑
    const SLIDE_OP_RIGHT = 1;
    //超级喜欢
    const SLIDE_OP_SUPERLIKE = 2;


    /**
     * 添加充值记录
     */
    static function addRecord(
        $userId = 0,
        $op = 0,
        $momentId = 0,
        $momentUserId = 0
    ) {
        $model = new self();
        $model->user_id = $userId;
        $model->op = $op;
        $model->moment_id = $momentId;
        $model->moment_user_id = $momentUserId;
        return $model->saveOrFail() ? 1 : 0;
    }
}
